const data = {
    destDirName: "mark",
    inPlace: false,
    noEscape: true,
    isNotTest: true,
    name: "mark",
    description: "A Vue.js project",
    author: 'LongXiaoBai <wlan945636373@gmail.com>',
    build: "standalone",
    // router: false,
    // lint: true,
    // lintConfig: "standard",
    // unit: false,
    // e2e: false,
    router: true,
    lint: true,
    lintConfig: 'standard',
    unit: true,
    runner: 'jest',
    e2e: true,
    autoInstall: "npm"
};

const filters = {
    '.eslintrc.js': 'lint',
    '.eslintignore': 'lint',
    'config/test.env.js': 'unit || e2e',
    'build/webpack.test.conf.js': "unit && runner === 'karma'",
    'test/unit/**/*': 'unit',
    'test/unit/index.js': "unit && runner === 'karma'",
    'test/unit/jest.conf.js': "unit && runner === 'jest'",
    'test/unit/karma.conf.js': "unit && runner === 'karma'",
    'test/unit/specs/index.js': "unit && runner === 'karma'",
    'test/unit/setup.js': "unit && runner === 'jest'",
    'test/e2e/**/*': 'e2e',
    'src/router/**/*': 'router'
};

// with 语句的原本用意是为逐级的对象访问提供命名空间式的速写方式;
// 也就是在指定的代码区域, 直接通过节点名称调用对象
const evaluate = (exp, data) => {
    try {
        with (data) {
            return eval(exp)
        }
    } catch (error) {
        console.error(error);
    }
}

// console.log(evaluate("unit && runner === 'karma'", data));

module.exports = evaluate;

